
package cn.edu.scau.cmi.hombio.domain;

import java.io.Serializable;

import java.lang.StringBuilder;

import java.util.LinkedHashSet;
import java.util.Set;

import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

import org.codehaus.jackson.annotate.JsonIgnore;

import javax.xml.bind.annotation.*;

import javax.persistence.*;

/**
 */

@Entity
@NamedQueries({
		@NamedQuery(name = "findAllCureTypes", query = "select myCureType from CureType myCureType"),
		@NamedQuery(name = "findCureTypeById", query = "select myCureType from CureType myCureType where myCureType.id = ?1"),
		@NamedQuery(name = "findCureTypeByMemo", query = "select myCureType from CureType myCureType where myCureType.memo = ?1"),
		@NamedQuery(name = "findCureTypeByMemoContaining", query = "select myCureType from CureType myCureType where myCureType.memo like ?1"),
		@NamedQuery(name = "findCureTypeByName", query = "select myCureType from CureType myCureType where myCureType.name = ?1"),
		@NamedQuery(name = "findCureTypeByNameContaining", query = "select myCureType from CureType myCureType where myCureType.name like ?1"),
		@NamedQuery(name = "findCureTypeByPrimaryKey", query = "select myCureType from CureType myCureType where myCureType.id = ?1") })

@Table(catalog = "pig", name = "cure_type")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(namespace = "pigRs/cn/edu/scau/cmi/hombio/domain", name = "CureType")
@XmlRootElement(namespace = "pigRs/cn/edu/scau/cmi/hombio/domain")
public class CureType implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 */

	@Column(name = "Id", nullable = false)
	@Basic(fetch = FetchType.EAGER)

	@Id @GeneratedValue
	@XmlElement
	Integer id;
	/**
	 */

	@Column(name = "Name", nullable = false)
	@Basic(fetch = FetchType.EAGER)

	@XmlElement
	String name;
	/**
	 */

	@Column(name = "Memo")
	@Basic(fetch = FetchType.EAGER)

	@XmlElement
	String memo;

	/**
	 */
	@OneToMany(mappedBy = "cureType", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)

	
	java.util.Set<cn.edu.scau.cmi.hombio.domain.CureMethod> cureMethods;
	/**
	 */
	@OneToMany(mappedBy = "cureType", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)

	
	java.util.Set<cn.edu.scau.cmi.hombio.domain.CureTaskMethod> cureTaskMethods;

	/**
	 */
	public void setId(Integer id) {
		this.id = id;
	}

	/**
	 */
	public Integer getId() {
		return this.id;
	}

	/**
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 */
	public String getName() {
		return this.name;
	}

	/**
	 */
	public void setMemo(String memo) {
		this.memo = memo;
	}

	/**
	 */
	public String getMemo() {
		return this.memo;
	}

	/**
	 */
	public void setCureMethods(Set<CureMethod> cureMethods) {
		this.cureMethods = cureMethods;
	}

	/**
	 */
	@JsonIgnore
	public Set<CureMethod> getCureMethods() {
		if (cureMethods == null) {
			cureMethods = new java.util.LinkedHashSet<cn.edu.scau.cmi.hombio.domain.CureMethod>();
		}
		return cureMethods;
	}

	/**
	 */
	public void setCureTaskMethods(Set<CureTaskMethod> cureTaskMethods) {
		this.cureTaskMethods = cureTaskMethods;
	}

	/**
	 */
	@JsonIgnore
	public Set<CureTaskMethod> getCureTaskMethods() {
		if (cureTaskMethods == null) {
			cureTaskMethods = new java.util.LinkedHashSet<cn.edu.scau.cmi.hombio.domain.CureTaskMethod>();
		}
		return cureTaskMethods;
	}

	/**
	 */
	public CureType() {
	}

	/**
	 * Copies the contents of the specified bean into this bean.
	 *
	 */
	public void copy(CureType that) {
		setId(that.getId());
		setName(that.getName());
		setMemo(that.getMemo());
		setCureMethods(new java.util.LinkedHashSet<cn.edu.scau.cmi.hombio.domain.CureMethod>(that.getCureMethods()));
		setCureTaskMethods(new java.util.LinkedHashSet<cn.edu.scau.cmi.hombio.domain.CureTaskMethod>(that.getCureTaskMethods()));
	}

	/**
	 * Returns a textual representation of a bean.
	 *
	 */
	public String toString() {

		StringBuilder buffer = new StringBuilder();

		buffer.append("id=[").append(id).append("] ");
		buffer.append("name=[").append(name).append("] ");
		buffer.append("memo=[").append(memo).append("] ");

		return buffer.toString();
	}

	/**
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = (int) (prime * result + ((id == null) ? 0 : id.hashCode()));
		return result;
	}

	/**
	 */
	public boolean equals(Object obj) {
		if (obj == this)
			return true;
		if (!(obj instanceof CureType))
			return false;
		CureType equalCheck = (CureType) obj;
		if ((id == null && equalCheck.id != null) || (id != null && equalCheck.id == null))
			return false;
		if (id != null && !id.equals(equalCheck.id))
			return false;
		return true;
	}
}
